import combinationApi from "@/api/declaration/mall/combinationApi"
import httpRequest from "@/config/axios/httpRequest"
import { CombinationActivityModel } from "@/models/mall/CombinationActivityModel"


// 查询拼团活动列表
export const getCombinationActivityPage = async (params: any) => {
  return await httpRequest.get(combinationApi.GetCombinationActivityPage, params)
}

// 查询拼团活动详情
export const getCombinationActivity = async (id: number) => {
  return await httpRequest.get(combinationApi.GetCombinationActivity, { params: { id } })
}

// 获得拼团活动列表，基于活动编号数组
export const getCombinationActivityListByIds = (ids: number[]) => {
  return httpRequest.get(combinationApi.GetCombinationActivityListByIds, { params: { ids } })
}

// 新增拼团活动
export const createCombinationActivity = async (data: CombinationActivityModel) => {
  return await httpRequest.post(combinationApi.CreateCombinationActivity, data)
}

// 修改拼团活动
export const updateCombinationActivity = async (data: CombinationActivityModel) => {
  return await httpRequest.put(combinationApi.UpdateCombinationActivity, data)
}

// 关闭拼团活动
export const closeCombinationActivity = async (id: number) => {
  return await httpRequest.put(combinationApi.CloseCombinationActivity, { id })
}

// 删除拼团活动
export const deleteCombinationActivity = async (id: number) => {
  return await httpRequest.delete(combinationApi.DeleteCombinationActivity, { params: { id } })
}
